package com.sgb.member.ui.adapter;

import android.content.Context;
import android.text.TextUtils;
import android.view.View;

import com.sgb.member.BR;
import com.sgb.member.MemberConfig;
import com.sgb.member.R;
import com.sgb.member.databinding.ItemClientQualificationBinding;
import com.sgb.member.entity.ClientQualificationBean;
import com.swgk.core.recyclerview.adapter.BaseRecycleAdapter;
import com.swgk.core.recyclerview.adapter.ItemViewHolder;
import com.swgk.core.util.MToast;

import java.util.List;

public class ClientQualificationAdapter extends BaseRecycleAdapter<ClientQualificationBean> {

    public ClientQualificationAdapter(Context context, List<ClientQualificationBean> datas) {
        super(context, R.layout.item_client_qualification, datas);
    }

    @Override
    public void convert(ItemViewHolder holder, final ClientQualificationBean entity) {
        holder.setBinding(BR.viewModel, entity);
        ItemClientQualificationBinding binding = (ItemClientQualificationBinding) holder.getmBinding();
        binding.tvCompanyName.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                if (!TextUtils.isEmpty(entity.getCompanyNo())) {
                    MemberConfig.getInstance().startWebsiteInfo(context, entity.getCompanyNo(), 1);
                } else {
                    MToast.showToast(context, "店铺No为空");
                }
            }
        });
    }
}
